home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / gradient-bevel-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  5.1 KB  |  141 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; This program is free software; you can redistribute it and/or modify
  4. ; it under the terms of the GNU General Public License as published by
  5. ; the Free Software Foundation; either version 2 of the License, or
  6. ; (at your option) any later version.
  7. ; This program is distributed in the hope that it will be useful,
  8. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10. ; GNU General Public License for more details.
  11. ; You should have received a copy of the GNU General Public License
  12. ; along with this program; if not, write to the Free Software
  13. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. ;
  15. ;  Gradient Bevel v0.1  04/08/98
  16. ;  by Brian McFee <keebler@wco.com>
  17. ;  Create cool glossy bevelly text
  18.  
  19. (define (apply-gradient-bevel-logo-effect img
  20.                       logo-layer
  21.                       b-size
  22.                       bevel-height
  23.                       bevel-width
  24.                       bg-color)
  25.   (let* ((width (car (gimp-drawable-width logo-layer)))
  26.      (height (car (gimp-drawable-height logo-layer)))
  27.          (indentX (+ b-size 12))
  28.      (indentY (+ b-size (/ height 8)))
  29.      (bg-layer (car (gimp-layer-new img width height RGBA-IMAGE "Background" 100 NORMAL-MODE)))
  30.      (blur-layer (car (gimp-layer-new img width height RGBA-IMAGE "Blur" 100 NORMAL-MODE))))
  31.  
  32.     (gimp-context-push)
  33.  
  34.     (script-fu-util-image-resize-from-layer img logo-layer)
  35.     (gimp-image-add-layer img bg-layer 1)
  36.     (gimp-image-add-layer img blur-layer 1)
  37.  
  38.     (gimp-selection-all img)
  39.     (gimp-context-set-background bg-color)
  40.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  41.     (gimp-selection-none img)
  42.  
  43.     (gimp-layer-set-preserve-trans blur-layer TRUE)
  44.     (gimp-context-set-background '(255 255 255))
  45.     (gimp-selection-all img)
  46.     (gimp-edit-fill blur-layer BACKGROUND-FILL)
  47.     (gimp-edit-clear blur-layer)
  48.     (gimp-selection-none img)
  49.     (gimp-layer-set-preserve-trans blur-layer FALSE)
  50.     (gimp-selection-layer-alpha logo-layer)
  51.     (gimp-edit-fill blur-layer BACKGROUND-FILL)
  52.     (plug-in-gauss-rle 1 img blur-layer bevel-width 1 1)
  53.     (gimp-selection-none img)
  54.     (gimp-context-set-background '(127 127 127))
  55.     (gimp-context-set-foreground '(255 255 255))
  56.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  57.     (gimp-selection-all img)
  58.  
  59.     (gimp-edit-blend logo-layer FG-BG-RGB-MODE NORMAL-MODE
  60.              GRADIENT-RADIAL 95 0 REPEAT-NONE FALSE
  61.              FALSE 0 0 TRUE
  62.              indentX indentY indentX (- height indentY))
  63.  
  64.     (gimp-selection-none img)
  65.     (gimp-layer-set-preserve-trans logo-layer FALSE)
  66.     (plug-in-bump-map 1 img logo-layer blur-layer 115 bevel-height 5 0 0 0 15 TRUE FALSE 0)
  67.     (gimp-layer-set-offsets blur-layer 5 5)
  68.     (gimp-invert blur-layer)
  69.     (gimp-layer-set-opacity blur-layer 50.0)
  70.     (gimp-image-set-active-layer img logo-layer)
  71.  
  72.     (gimp-context-pop)))
  73.  
  74. (define (script-fu-gradient-bevel-logo-alpha img
  75.                          logo-layer
  76.                          b-size
  77.                          bevel-height
  78.                          bevel-width
  79.                          bg-color)
  80.   (begin
  81.     (gimp-image-undo-group-start img)
  82.     (apply-gradient-bevel-logo-effect img logo-layer b-size
  83.                       bevel-height bevel-width bg-color)
  84.     (gimp-image-undo-group-end img)
  85.     (gimp-displays-flush)))
  86.  
  87. (script-fu-register "script-fu-gradient-bevel-logo-alpha"
  88.             _"Gradient Beve_l..."
  89.             "Makes Shiny Bevelly text"
  90.             "Brian McFee <keebler@wco.com>"
  91.             "Brian McFee"
  92.             "April 1998"
  93.             "RGBA"
  94.                     SF-IMAGE      "Image"                     0
  95.                     SF-DRAWABLE   "Drawable"                  0
  96.             SF-ADJUSTMENT _"Border size (pixels)"     '(22 1 300 1 10 0 1)
  97.             SF-ADJUSTMENT _"Bevel height (Sharpness)" '(40 1 250 1 10 0 1)
  98.             SF-ADJUSTMENT _"Bevel width"              '(2.5 1 200 1 10 1 1)
  99.             SF-COLOR      _"Background color"         '(255 255 255))
  100.  
  101. (script-fu-menu-register "script-fu-gradient-bevel-logo-alpha"
  102.              _"<Image>/Script-Fu/Alpha to Logo")
  103.  
  104.  
  105. (define (script-fu-gradient-bevel-logo text
  106.                        size
  107.                        font
  108.                        bevel-height
  109.                        bevel-width
  110.                        bg-color)
  111.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  112.          (border (/ size 4))
  113.      (text-layer (car (gimp-text-fontname img -1 0 0 text
  114.                           border TRUE size PIXELS font))))
  115.     (gimp-image-undo-disable img)
  116.     (gimp-drawable-set-name text-layer text)
  117.     (apply-gradient-bevel-logo-effect img text-layer border
  118.                       bevel-height bevel-width bg-color)
  119.     (gimp-image-undo-enable img)
  120.     (gimp-display-new img)))
  121.  
  122. (script-fu-register "script-fu-gradient-bevel-logo"
  123.             _"Gradient Beve_l..."
  124.             "Makes Shiny Bevelly text"
  125.             "Brian McFee <keebler@wco.com>"
  126.             "Brian McFee"
  127.             "April 1998"
  128.             ""
  129.             SF-STRING     _"Text"                     "Moo"
  130.             SF-ADJUSTMENT _"Font size (pixels)"       '(90 2 1000 1 10 0 1)
  131.             SF-FONT       _"Font"                     "Sans Bold"
  132.             SF-ADJUSTMENT _"Bevel height (sharpness)" '(40 1 250 1 10 0 1)
  133.             SF-ADJUSTMENT _"Bevel width"              '(2.5 1 200 1 10 1 1)
  134.             SF-COLOR      _"Background color"         '(255 255 255))
  135.  
  136. (script-fu-menu-register "script-fu-gradient-bevel-logo"
  137.              _"<Toolbox>/Xtns/Script-Fu/Logos")
  138.